<?php 
/* SVN FILE: $Id$ */
/* News Test cases generated on: 2009-10-31 15:26:04 : 1257013564*/
App::import('Model', 'News.News');

class NewsTestCase extends CakeTestCase {
	var $News = null;
	var $fixtures = array('plugin.news.news');

	function startTest() {
		$this->News =& ClassRegistry::init('News');
	}

	function testNewsInstance() {
		$this->assertTrue(is_a($this->News, 'News'));
	}

	function testNewsFind() {
		$this->News->recursive = -1;
		$results = $this->News->find('first');
		$this->assertTrue(!empty($results));
		$expected = array('News' => array(
			'id'  => 1,
			'title'  => 'Lorem ipsum dolor sit amet',
			'descripcion'  => 'Lorem ipsum dolor sit amet',
			'contenido'  => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida,phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam,vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit,feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
			'created'  => '2009-10-31 15:26:02'
		));
		$this->assertEqual($results, $expected);
	}
	
	function testNewsEdit() {
		
		$this->data = $this->News->find('all');
		$this->News->delete('all');
   		
		
		if (!empty($this->data)) {
			foreach($this->data as $new){
				if ($this->News->save($new)) {
					
				} else {
					$this->assertTrue(false);
				}
			}
		}
		$news =  $this->News->find('all');
		
		$this->assertEqual($this->data, $news);
	}
}
?>